*********************************************
*	Author: Rithika Kumar	                *
*   Table A12 (Appendix D)                   * 
*********************************************

** Set working directory to "JOP Replication files" folder on your computer 

use "DATA FILES TO SHARE/farm_work_EW.dta", replace

set more off 

** simple mean of farm income for both groups 

mean INCAG if year == 0 & w2_abshusband ==0
mean INCAG if year == 1 & w2_abshusband ==0
mean INCAG if year == 0 & w2_abshusband ==1
mean INCAG if year == 1 & w2_abshusband ==1


** Agricultural income 
gen did = 0 
replace did = 1 if   w2_abshusband_dummy == 1 & year == 1


est clear
*1. SIMPLE (NO FE) but onnly RURAL
quietly reg INCAG i.w2_abshusband_dummy i.year did if URBAN == 0 & did_sample==1, vce(cluster vill_id_num)
eststo reg_naive_rural

*2. SIMPLE with District FE but onnly RURAL and conntrols 
quietly reghdfe INCAG i.w2_abshusband_dummy i.year did  if URBAN == 0 & did_sample==1, vce(cluster vill_id_num) absorb(DISTID)
eststo reg_distfe_rural

*3. SIMPLE with PSU FE but onnly RURAL and conntrols 
quietly reg INCAG i.w2_abshusband_dummy i.year did if URBAN == 0& did_sample==1, vce(cluster vill_id_num) absorb(vill_id_num)
eststo reg_villfe_rural

*4. For HH level fixed effects

reghdfe INCAG i.w2_abshusband_dummy i.year did if did_sample== 1 & URBAN == 0, absorb(hhuid_num) vce(cluster vill_id_num)
eststo reg_ivfe_rural


**** HOUSEHOLD INCOME **
** USING LOG OF INCOME variable REPORTED - log_inc

*1. SIMPLE (NO FE)
quietly reghdfe log_inc i.w2_abshusband_dummy i.year did if did_sample ==1, absorb() vce(cluster vill_id_num)
eststo inc_naive

*2. SIMPLE with District FE  

quietly reghdfe log_inc i.w2_abshusband_dummy i.year did if  did_sample ==1, absorb(DISTID) vce(cluster vill_id_num)
eststo inc_statefe

*3. SIMPLE with Village FE  
quietly reghdfe log_inc i.w2_abshusband_dummy i.year did if  did_sample ==1, absorb(vill_id_num) vce(cluster vill_id_num)
eststo inc_distfe

*4. SIMPLE with HH FE  
 reghdfe log_inc i.w2_abshusband_dummy i.year did if  did_sample ==1, absorb(hhuid_num) vce(cluster vill_id_num)
eststo inc_hhfe

esttab reg_* inc_* using "OUTPUT/TABLES/Table_A12.tex", replace title("Male Migration does not affect farm and household income") ///
    label  ///
    prehead("\begin{table}[H]" "\small" "\centering" "\caption{Male migration does not activate the economic channel}" ///
            "\begin{tabular}{lcccccccc}" "\toprule" ///
            "& \multicolumn{4}{c}{\textit{Farm income}} & \multicolumn{4}{c}{\textit{Log of household income (reported)}}\\" ///
            "&(1)&(2)&(3)&(4)\\" "\hline") ///
    posthead("") keep(1.w2_abshusband_dummy 1.year did) varlabels(1.w2_abshusband_dummy "Migrant Husband"  1.year "Wave 2" did  "Migrant Husband $\times$ Wave 2") ///
	stats( r2_a N, fmt(%9.4f %9.0f) labels("Adj R-sq" "Observations")) cells(b(fmt(a2) star) se(par fmt(a2))) starlevels(* 0.10 ** 0.05 *** 0.01) style(tex) collabels(, none) mlabels(, none) ///
     postfoot(  "Fixed Effects & None & District &Village &Household & None & District &Village &Household\\" "\bottomrule" "\end{tabular}" "\label{tab:main_farm_hh_inc}" "\begin{tablenotes}" ///
             "\noindent Notes: DID analysis using household data show that male migration does not have a significant effect on household income. Therefore, while there is an overall increase in income for both groups of households, the increase among the households with migrants is no more that. However, it has a negative effect on farm income. The farm income includes income from land, crops/produce and animals for households in rural areas. In this analysis I include fixed effects at the district, village and household level. Standard errors are clustered at the village level (primary sampling unit). The results confirm that income is unlikely to increase due to male migration, and therefore the increase in autonomy among women is unlikely to be driven by this economic channel " "\end{tablenotes}" "\end{table}")
	





